package jlib.component.list
{
	import flash.display.DisplayObject;
	import flash.display.Shape;
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.text.TextFieldAutoSize;
	
	import jlib.component.button.ButtonState;
	import jlib.component.button.IButton;
	import jlib.component.button.LabelButton;
	import jlib.component.button.SkinButton;
	import jlib.utils.DisplayObjectContainerUtil;

	public class ButtonItem extends AbstractItem {
		private var m_button:IButton;
		private var m_data:Object;
		
		public function ButtonItem($button:IButton, $data:Object=null):void {
			m_button = $button;
			setData($data);
			addChild(m_button as DisplayObject);
		}
		
		override public function setData($data:Object):void {
			m_data = $data;
		}
		
		override public function isSelected():Boolean { 
			return m_button.isSelected();
		}
		
		override public function select(e:Object=null): void {
			if(!m_button.isSelected()) m_button.toggle();
		}
		
		override public function deselect(e:Object=null): void { 
			if(m_button.isSelected()) m_button.toggle(); 
		}
		
		public function getButton(): IButton { return m_button; }
		
		override public function getData():Object { return m_data; }
		
	}//c
}